/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package REA.impl;

import REA.EconomicEvent;
import REA.REAPackage;
import REA.duality;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>duality</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link REA.impl.dualityImpl#getInEconomicEvent <em>In Economic Event</em>}</li>
 *   <li>{@link REA.impl.dualityImpl#getOutEconomicEvent <em>Out Economic Event</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class dualityImpl extends REARelationsImpl implements duality {
	/**
	 * The cached value of the '{@link #getInEconomicEvent() <em>In Economic Event</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getInEconomicEvent()
	 * @generated
	 * @ordered
	 */
	protected EconomicEvent inEconomicEvent;

	/**
	 * The cached value of the '{@link #getOutEconomicEvent() <em>Out Economic Event</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOutEconomicEvent()
	 * @generated
	 * @ordered
	 */
	protected EconomicEvent outEconomicEvent;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected dualityImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return REAPackage.Literals.DUALITY;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EconomicEvent getInEconomicEvent() {
		if (inEconomicEvent != null && inEconomicEvent.eIsProxy()) {
			InternalEObject oldInEconomicEvent = (InternalEObject)inEconomicEvent;
			inEconomicEvent = (EconomicEvent)eResolveProxy(oldInEconomicEvent);
			if (inEconomicEvent != oldInEconomicEvent) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, REAPackage.DUALITY__IN_ECONOMIC_EVENT, oldInEconomicEvent, inEconomicEvent));
			}
		}
		return inEconomicEvent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EconomicEvent basicGetInEconomicEvent() {
		return inEconomicEvent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setInEconomicEvent(EconomicEvent newInEconomicEvent) {
		EconomicEvent oldInEconomicEvent = inEconomicEvent;
		inEconomicEvent = newInEconomicEvent;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, REAPackage.DUALITY__IN_ECONOMIC_EVENT, oldInEconomicEvent, inEconomicEvent));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EconomicEvent getOutEconomicEvent() {
		if (outEconomicEvent != null && outEconomicEvent.eIsProxy()) {
			InternalEObject oldOutEconomicEvent = (InternalEObject)outEconomicEvent;
			outEconomicEvent = (EconomicEvent)eResolveProxy(oldOutEconomicEvent);
			if (outEconomicEvent != oldOutEconomicEvent) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, REAPackage.DUALITY__OUT_ECONOMIC_EVENT, oldOutEconomicEvent, outEconomicEvent));
			}
		}
		return outEconomicEvent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EconomicEvent basicGetOutEconomicEvent() {
		return outEconomicEvent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setOutEconomicEvent(EconomicEvent newOutEconomicEvent) {
		EconomicEvent oldOutEconomicEvent = outEconomicEvent;
		outEconomicEvent = newOutEconomicEvent;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, REAPackage.DUALITY__OUT_ECONOMIC_EVENT, oldOutEconomicEvent, outEconomicEvent));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case REAPackage.DUALITY__IN_ECONOMIC_EVENT:
				if (resolve) return getInEconomicEvent();
				return basicGetInEconomicEvent();
			case REAPackage.DUALITY__OUT_ECONOMIC_EVENT:
				if (resolve) return getOutEconomicEvent();
				return basicGetOutEconomicEvent();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case REAPackage.DUALITY__IN_ECONOMIC_EVENT:
				setInEconomicEvent((EconomicEvent)newValue);
				return;
			case REAPackage.DUALITY__OUT_ECONOMIC_EVENT:
				setOutEconomicEvent((EconomicEvent)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case REAPackage.DUALITY__IN_ECONOMIC_EVENT:
				setInEconomicEvent((EconomicEvent)null);
				return;
			case REAPackage.DUALITY__OUT_ECONOMIC_EVENT:
				setOutEconomicEvent((EconomicEvent)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case REAPackage.DUALITY__IN_ECONOMIC_EVENT:
				return inEconomicEvent != null;
			case REAPackage.DUALITY__OUT_ECONOMIC_EVENT:
				return outEconomicEvent != null;
		}
		return super.eIsSet(featureID);
	}

} //dualityImpl
